package com.bawei.lookfor2204a.view.activity

import android.content.Intent
import android.os.CountDownTimer
import com.bawei.lookfor2204a.R
import com.bawei.lookfor2204a.base.BaseViewActivity
import com.bawei.lookfor2204a.databinding.ActivityStartBinding

/**
 * 启动欢迎页
 */
class StartActivity : BaseViewActivity<ActivityStartBinding>(R.layout.activity_start) {

    override fun initData() {
    }

    override fun initView() {
        // 倒计时2秒
        object : CountDownTimer(2000, 1000) {
            override fun onTick(p0: Long) {
                binding.tvSecond.text = "${p0/1000 + 1}S"
            }

            override fun onFinish() {
                // 进入主页面
                startActivity(Intent(this@StartActivity, MainActivity::class.java))
                // 关闭欢迎页面
                finish()
            }
        }.start()
    }
}